package com.hq.tomato.ms.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Optional;

import static com.hq.tomato.ms.config.TomatoMsProperties.TOMAT_MS_PREFIX;

/**
 *
 *
 * @Description: <br>
 * @Project: <br>
 * @CreateDate: Created in 2019-11-23 15:00 <br>
 * @Author: <a href="1026365768@qq.com">qiang.hu</a>
 */

@ConfigurationProperties(prefix = TOMAT_MS_PREFIX)
public class TomatoMsProperties {
    public static final String TOMAT_MS_PREFIX = "tomato.ms";
    private final Integer DEFAULT_RETRY_NUM = 10;

    private Integer maxRetryNum;

    public Integer getMaxRetryNum() {
        return Optional.ofNullable(maxRetryNum).orElse(DEFAULT_RETRY_NUM);
    }

    public void setMaxRetryNum(Integer maxRetryNum) {
        this.maxRetryNum = maxRetryNum;
    }
}
